package com.liuyi.pay.ali;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 支付宝支付配置类
 */
@Component
@PropertySource("classpath:/pay.properties")
@ConfigurationProperties(prefix = "alipay")
@Data
public class AliPayBeans {

    private List<AliPayBean> beans;

    public AliPayBean get(String appid) {
        for (AliPayBean item : beans) {
            if (item.getAppId().equals(appid)) {
                return item;
            }
        }
        return null;
    }
}
